package com.ityu.cloudserver.controller;

import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * author: yu.jl
 * e-mail: bbfx89625@gmail.com
 * time  : 2021/6/25
 * desc  :
 */
@RestController
@Slf4j
class CloudServerController {
    @ApiOperation(value = "测试服务1")
    @GetMapping(value = "/testServerOne")
    public String testServerOne() {
        return "我是服务二的无参接口";
    }

    @ApiOperation(value = "测试服务1")
    @GetMapping(value = "/testServerTwo/{name}/{content}")
    public String testServerTwo(@PathVariable String name, @PathVariable String content) {
        log.info("{}输入的内容为{}", name, content);
        return "我是服务二的有参接口" + name + content;
    }



    @ApiOperation(value = "测试异常")
    @GetMapping(value = "/testError")
    public String testError() {
        log.info("testError");
        throw new  NullPointerException();
    }


    @ApiOperation(value = "测试异常2")
    @GetMapping(value = "/testError2")
    public String testError2()  {
        log.info("testError2");
        throw new  NullPointerException();
    }
}
